Skip to content

Conversation

@OpenStaxClaude
Copy link
Contributor

Summary

Port all 6 JavaScript files in src/app/layouts/default/takeover-dialog to TypeScript following the project's guidelines.

Changes

  • takeover-context.jstakeover-context.tsx
  • common.jscommon.tsx
  • content-desktop.jscontent-desktop.tsx
  • content-mobile.jscontent-mobile.tsx
  • takeover-dialog-content.jstakeover-dialog-content.tsx
  • takeover-dialog.jstakeover-dialog.tsx

Guidelines Followed

  • Avoided using any type
  • Preferred type over interface
  • Relied on type inference rather than explicit typing where possible
  • Used inline type definitions for function parameters
  • Kept line lengths under 120 characters
  • Each file ends with a newline

Test Plan

  • Build passes without type errors
  • No runtime errors in takeover dialog functionality
  • Visual regression tests pass

Related to: https://openstax.atlassian.net/browse/CORE-1265

🤖 Generated with Claude Code

@OpenStaxClaude OpenStaxClaude marked this pull request as ready for review October 30, 2025 15:06
OpenStaxClaude and others added 3 commits October 30, 2025 10:46
- Port all 6 files in src/app/layouts/default/takeover-dialog to .tsx
- Add type annotations following guidelines: avoid any, prefer type over interface
- Use inline type definitions for function parameters
- Rely on type inference where possible
- Keep line lengths under 120 characters

Related to CORE-1265

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Make children prop optional to fix TypeScript type issue

The project has incomplete React type definitions, causing TypeScript to not
recognize children passed via JSX syntax. Making the prop optional resolves this.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Fix TypeScript array concat issue in takeover-dialog

Replace array concat pattern with explicit array handling to satisfy TypeScript type checking.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@RoyEJohnson RoyEJohnson force-pushed the port-takeover-dialog-ts branch from 1706634 to 9364a28 Compare October 30, 2025 22:40
@RoyEJohnson RoyEJohnson requested a review from jivey October 31, 2025 19:25
Copy link
Contributor

@RoyEJohnson RoyEJohnson Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the first commit for the real changes for all the files in the takeover-dialog folder. It's all just adding types. The final commit is prettier, which is what changed the file enough that it registered as delete-and-create.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the overlapping-quote section got removed in the last assignable page update but the supporting source files weren't cleaned up.

import booksForAnalyticsData from '../src/data/books-for-analytics';
import bookTitleData from '../src/data/book-titles';
import buyprintData from '../src/data/buyprint';
import chemistryData from '../src/data/chemistry-atoms-first.json';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a book with a different book_state to test non-live book display

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted from default.test for re-use.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were a few files that lacked test coverage for little bits. This is one.

Copy link
Member

@jivey jivey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little concerned about the non-null assertion but everything else seems good

<MessageBox
buttonText={data.buttonText}
buttonUrl={data.buttonUrl}
headline={data.boxHeadline!}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add undefined to the MessageBox prop types instead using assertions, seems like it would catch issues with future changes to that component.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the fields in the data that comes from the CMS non-optional. It includes them even if they're empty. I might have made them optional when they were first added so they'd be backward compatible with the CMS until it updated.

@RoyEJohnson RoyEJohnson merged commit cc56037 into main Nov 4, 2025
1 check passed
@RoyEJohnson RoyEJohnson deleted the port-takeover-dialog-ts branch November 4, 2025 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants